package transferFunctions;

public class HiperbolicTangens implements TransferFunction{

	private double beta;
	
	public HiperbolicTangens() {
		this(1);
	}
	
	public HiperbolicTangens(double beta) {
		this.beta = beta;
	}
	
	@Override
	public double transfer(double net) {
		double e1 = Math.pow(Math.E, beta*net);
		double e2 = Math.pow(Math.E, -beta*net);
		return (e1 - e2)/(e1 + e2);
	}

	@Override
	public double derivative(double net) {
		
		return (1.0/2.0)*(1.0 + transfer(net))*(1.0 - transfer(net));
	}

	
}
